var http = require('/lib/http.js')
App({
  onLaunch: function () {
    if (!wx.cloud) {
      console.error('请使用 2.2.3 或以上的基础库以使用云能力')
    } else {
      wx.cloud.init({
        env: 'xiaojiejie-vxfxj',
        traceUser: true,
      })
    }
    var infoSync=wx.getSystemInfoSync()
    // console.log("this.globalData.height==" + JSON.stringify(infoSync))
    this.globalData.height = infoSync.screenHeight
    const updateManager = wx.getUpdateManager()
    updateManager.onCheckForUpdate(function (res) {
      console.log(res.hasUpdate)
      if (res.hasUpdate) {
        updateManager.onUpdateReady(function () {
          wx.showModal({
            title: '更新提示',
            content: '新版本已经准备好，享受更多新功能,是否重启应用？',
            success: function (res) {
              if (res.confirm) {
                updateManager.applyUpdate()
              }
            }
          })
        })
      }
    })
  },
  globalData: {
    userInfo: '',
    height:0,
  },
  request: {
    reqLoading: http.reqLoading,
    req: http.req,
    reqCloudLoading: http.reqCloudLoading,
    reqCloud: http.reqCloud
  },
  SetUserInfoMsg: function (info) {
    return wx.setStorageSync("USERINFO", info)
  },
  GetUserInfoMsg: function () {
    return wx.getStorageSync("USERINFO")
  },
  showToastMsg:function(msg){
    wx.showToast({
      title: msg,
      icon:"none"
    })
  }
})
